package com.zmzncs.lmtc.module.shop.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zmzncs.lmtc.module.park.dao.ParkInfoDao;
import com.zmzncs.lmtc.module.park.pojo.parkinfo.ParkInfo;
import com.zmzncs.lmtc.module.shop.pojo.park_ticket_set.ParkTicketSet;
import com.zmzncs.lmtc.module.shop.dao.ParkTicketSetMapper;
import com.zmzncs.lmtc.module.shop.pojo.park_ticket_set.ParkTicketSetDTO;
import com.zmzncs.lmtc.module.shop.pojo.park_ticket_set.ParkTicketSetSearchForm;
import com.zmzncs.lmtc.module.shop.service.ParkTicketSetService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商户-停车券-配置 服务实现类
 * </p>
 *
 * @author 高博文
 * @since 2021-06-30
 */
@Service
public class ParkTicketSetServiceImpl extends ServiceImpl<ParkTicketSetMapper, ParkTicketSet> implements ParkTicketSetService {

    @Autowired
    ParkTicketSetMapper parkTicketSetMapper;
    @Autowired
    ParkInfoDao parkInfoDao;

    @Override
    public IPage<ParkTicketSetDTO> getParkTicketByCoordinate(ParkTicketSetSearchForm form) {
        Long parkId = form.getParkId();
        if (parkId != null) {
            return parkTicketSetMapper.getParkTicetByParkId(form.getPage(),parkId);
        }
        return parkTicketSetMapper.getParkTicketByCoordinate(form.getPage(),form.getLongitude(),form.getLatitude());
    }
}
